package org.cuatrovientos.greet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Dani
 * Servlet implementation class SignUp
 */
@WebServlet("/SignUp")
public class SignUp extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SignUp() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter output = response.getWriter();
		
		String login = request.getParameter("login");
		String password = request.getParameter("password");
		String description = request.getParameter("description");
		String country = request.getParameter("country");
		String weapons[] = request.getParameterValues("weapons");
		String sex = request.getParameter("sex");
		String artifacts[] = request.getParameterValues("artifacts");
		
		output.write("Login: " + login + "<br/>");
		output.write("Password: " + password + "<br/>");
		output.write("Description: " + description + "<br/>");
		output.write("Country: " + country + "<br/>");
		output.write("<strong>Weapons: </strong><br/>");
		for (int i=0;i<weapons.length;i++){
			output.write(weapons[i] + "<br/>");
		}
		output.write("Sex: " + sex + "<br/>");
		output.write("<strong>Artifacts: </strong><br/>");
		for (int i=0;i<artifacts.length-1;i++){
			output.write(artifacts[i] + "<br/>");
		}
	}

}
